package com.yangjun.controller.report;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.yangjun.service.report.StoragePeriodReprotExportService;
import com.yangjun.vo.report.StoragePeriodReportExportVO;

@RestController
@RequestMapping(value="/excel/period")
public class StoragePeriodReprotExportController {
	
	@Autowired
	private StoragePeriodReprotExportService storagePeriodReprotExportService;
	
	@ResponseBody
	@RequestMapping("/getDeminsion")
	public Object getDeminsion(@RequestParam(value="reportid")String reportid,@RequestParam(value="userid")String userid){
		return storagePeriodReprotExportService.getDeminsion(reportid,userid);
	}
	@ResponseBody
	@RequestMapping("/queryDataByReportId")
	public Object queryDataByReportid(@RequestParam(value="reportid")String reportid){
		return storagePeriodReprotExportService.queryData(reportid);
	}
	@ResponseBody
	@RequestMapping("/queryData")
	public Object queryData(StoragePeriodReportExportVO spreVo){
		System.out.println(spreVo);
		return storagePeriodReprotExportService.queryData(spreVo);
	}
	
	@ResponseBody
	@RequestMapping("/addReport")
	public Object addReport(StoragePeriodReportExportVO spreVo){
		return storagePeriodReprotExportService.addOrUpdateReport(spreVo);
	}
	
	
	@ResponseBody
	@RequestMapping("/addDownloadTaskByReportId")
	public Object addDownloadTaskByReportId(@RequestParam(value="reportid")String reportid,HttpServletRequest request){
		return storagePeriodReprotExportService.addDownloadTask(reportid,request);
	}	
	
	@ResponseBody
	@RequestMapping("/addDownloadTask")
	public Object addDownloadTask(StoragePeriodReportExportVO spreVo,HttpServletRequest request){
		return storagePeriodReprotExportService.addDownloadTask(spreVo,request); 
	}
	
}
